// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'

import App from './App'
import router from './router'
import Vuex from 'vuex'
Vue.use(Vuex);

import AutoLoad from '@/AutoLoadTemps/AutoLoadTemp' //模板
Vue.prototype.$Mock = require('mockjs');  //获取临时数据

import VueTouch from 'vue-touch'  //全局 手机触屏 事件
Vue.use(VueTouch, {name: 'v-touch'});

import iView from 'iview';       //  样式
import 'iview/dist/styles/iview.css';//
Vue.use(iView);//

import API from '@/api/'   //全局API路由
Vue.prototype.http = new API;
import helps from '@/api/parts' //全局 Function 内置方法
Vue.prototype.$h = helps;

import ENV from './ENV'   //全局ENV配置文件
Vue.prototype.$ENV = ENV;

import 'mint-ui/lib/style.css'       // swipe  轮播图
import { Swipe, SwipeItem } from 'mint-ui';
Vue.component(Swipe.name, Swipe);
Vue.component(SwipeItem.name, SwipeItem);

import imgfactory from '@/imageFactory/image'  //全局获取图片方法
Vue.prototype.$img = new imgfactory();
import Getimage from '@/imageFactory/Getimage'//获取图片
Vue.use(Getimage);
Vue.config.productionTip = false;

import vuexjs from '@/api/vuex'
const store = new Vuex.Store({
  modules: {
    attribute: vuexjs.moduleClientRoute,   //存放属性
    array: vuexjs.moduleClientarray       //存放数组
  }
});

Vue.filter('toFix', function ($value) { //取前3位数
  let v = $value * 1;
  return v.toFixed(3)
});

/**********测试
 * **************/
// import mouse from './MyModule/mouse'


/* eslint-disable no-new */
var text = () => {
  setTimeout(() => {
    if (Vue.prototype.$imgList) {
      new Vue({
        el: '#app',
        router,
        store,
        template: '<App/>',
        components: {App}
      });
    } else {
      text();
    }
  }, 1)
};

text();
